package indi.zhifa.study2024.nbr.monitor.properties;

import cn.hutool.core.util.RandomUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Data
@ConfigurationProperties(prefix = "app.servers")
@Configuration
public class ServerConfigs {
    List<ServerConfig> serverConfigs;
    public String randomServName(){
        int rd = RandomUtil.randomInt(0, serverConfigs.size());
        return serverConfigs.get(rd).getUpstream();
    }
}
